package org.example;

public enum demo {
    NOTIFICATION_NEW_TASK(0,"待处理"){
        @Override
        public void pay() {
            System.out.println("NOTIFICATION_NEW_TASK执行了");
        }
    },
    NOTIFICATION_AUDIT_APPROVE(1,"审核通过") {
        @Override
        public void pay() {
            System.out.println("NOTIFICATION_AUDIT_APPROVE执行了");
        }
    },
    NOTIFICATION_AUDIT_REJECT(2,"审核不通过") {
        @Override
        public void pay() {
            System.out.println("NOTIFICATION_AUDIT_REJECT执行了");
        }
    };
    private final int code;
    private final String description;

    demo(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
    public abstract void pay();

    public static demo getDemo(int code){
        for (demo d : demo.values()) {
            if (d.getCode() == code) {
                return d;
            }
        }
        return null;
    }
}
